From 42564195d428564bd69803b64d7cde277a01cf2c Mon Sep 17 00:00:00 2001 From: Robert Lipe Date: Thu, 7 Dec 2017 00:31:07 -0600 Subject: [PATCH] Minor code cleanups. --- an1.cc | 4 +--- garmin_txt.cc | 2 +- shape.cc | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/an1.cc b/an1.cc index 951548921..a5b5b68cd 100644 --- a/an1.cc +++ b/an1.cc @@ -446,8 +446,6 @@ static void Read_AN1_Waypoint(gbfile* f, an1_waypoint_record* wpt) static void Write_AN1_Waypoint(gbfile* f, an1_waypoint_record* wpt) { - short len; - WriteShort(f, wpt->magic); WriteLong(f, wpt->unk1); WriteLong(f, wpt->lon); @@ -464,7 +462,7 @@ static void Write_AN1_Waypoint(gbfile* f, an1_waypoint_record* wpt) WriteShort(f, wpt->unk5); WriteDouble(f, wpt->radius); - len = strlen(wpt->name) + 1 + 2 + 2 + + short len = strlen(wpt->name) + 1 + 2 + 2 + (wpt->url ? strlen(wpt->url) : 0) + 2 + (wpt->comment ? strlen(wpt->comment) : 0) + 8 + 8; WriteShort(f, len); diff --git a/garmin_txt.cc b/garmin_txt.cc index ee62e9dcd..e5781fc3b 100644 --- a/garmin_txt.cc +++ b/garmin_txt.cc @@ -62,7 +62,7 @@ static time_t utc_offs = 0; // Having a Windows background, this software encodes degree marks in // Windows CP-1252. We don't attempt to handle all the subtleties of that, // but since we write degree marks and we know how they're encoded, use this. -static const char kDegreeSymbol = 0xB0; +static const unsigned char kDegreeSymbol = 0xB0; static gtxt_flags_t gtxt_flags; diff --git a/shape.cc b/shape.cc index 32282b96e..f1155fc5e 100644 --- a/shape.cc +++ b/shape.cc @@ -316,9 +316,9 @@ my_write_wpt(const Waypoint* wpt) // We could potentially write SHPT_POINTZ, but we would have // to address what to do when we don't have altitude data. shpobject = SHPCreateSimpleObject(SHPT_POINT, 1, - (double*)(void*)&wpt->longitude, - (double*)(void*)&wpt->latitude, - (double*)(void*)&wpt->altitude); + &wpt->longitude, + &wpt->latitude, + &wpt->altitude); int iShape = SHPWriteObject(ohandle, -1, shpobject); SHPDestroyObject(shpobject); DBFWriteStringAttribute(ohandledb, iShape, nameFieldIdx, -- 2.30.2